module.exports = {
  env: {
    NODE_ENV: '"production"'
  },
  defineConstants: {
  },
  mini: {
    // 小程序端文件名hash配置
    miniCssExtractPluginOption: {
      ignoreOrder: true,
      // 为CSS文件添加hash
      filename: '[name].[contenthash:8].css',
      chunkFilename: '[name].[contenthash:8].css'
    },
    // 通过webpackChain配置JS文件名hash
    webpackChain(chain) {
      // 为JS文件添加hash
      chain.output
        .filename('[name].[contenthash:8].js')
        .chunkFilename('[name].[contenthash:8].js')
    }
  },
  h5: {
    publicPath: '/',
    /**
     * CSS文件名hash配置
     */
    miniCssExtractPluginOption: {
      ignoreOrder: true,
      filename: 'assets/[name].[contenthash:8].css',
      chunkFilename: 'assets/[name].[contenthash:8].css'
    },
    /**
     * WebpackChain 插件配置 - 生产环境JS文件名hash配置
     * @docs https://github.com/neutrinojs/webpack-chain
     */
    webpackChain (chain) {
      // 为H5端配置JS文件名hash，并输出到assets目录
      chain.output
        .filename('assets/[name].[contenthash:8].js')
        .chunkFilename('assets/[name].[contenthash:8].js')
    }
  }
}
